package com.yq.emp.controller;

import com.yq.emp.model.Dept;
import com.yq.emp.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    DeptService deptService;

    @GetMapping("/all")
    public String all(Model model){
        List<Dept> list = deptService.getAllDept();
        model.addAttribute("depts",list);
        return "dept_list";
    }
}
